<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chi tiết sản phẩm</title>
</head>
<body bottomMargin=0 leftMargin=0
topMargin=0 rightMargin=0>
	<TABLE width="1024" height="768" border=0 cellSpacing=0 cellPadding=0 align=center>
	<TR HEIGHT="150">
	<TD Align=center colspan=5>
	<%@include file="top.jsp"%>
	</TD>
	</TR>
	
	<!---Khai báo khoảng phân cách--->
	<TR HEIGHT="2">
	<TD colspan=5 bgcolor="white"></TD>
	</TR>
	
	<TR HEIGHT=100%>
	<TD vAlign="top" width="150">
	<%@include file="left.jsp"%>
	</TD>
	
	<!---Khai báo khoảng phân cách--->
	<TD bgcolor=white width="2"></TD>
	
	<TD vAlign=top width="720" bgcolor=white>
		
	<%
		Class.forName("com.mysql.jdbc.Driver");
		Connection con = null;
		Statement smt = null;
		ResultSet rst = null;
		String path = null;
		out.println("<table width=100% height=100% border=0>");
		try {
			String username = "root";
			String password = "Vietyeutam1112";
			String ID = request.getParameter("ID");
			String buyOK = request.getParameter("buy");
			System.out.println(buyOK);
			String url = "jdbc:mysql://127.0.0.1:3306/banhang";
			con = DriverManager.getConnection(url, username, password);
			System.out.println("Da ket noi CSDL");
			smt = con.createStatement();
			rst = smt.executeQuery("select * from product where ID='"+ID+"'");
			rst.next();
			path = "<img src="+rst.getString(5)+" width=100% heigth=10s0% >";
			out.println("<tr>");
			out.println("<td width=50% height=20% align=center>"+path+"<br><font color=red>"+rst.getString(4)+" đ</font><br>"+rst.getString("state")+"</td>");
			out.println("<td width=50% align=center bgcolor=#C8DBDE>");
			out.println("<font color=#FF6700 size='5'>"+rst.getString("name")+"</font><br><br><br>");
			out.println("<form action=addtocart.jsp method=get>");
			out.println("<input type=hidden value='"+ID+"'"+" name=ID>");
			out.println("<input type=submit value='Thêm vào giỏ hàng'><br>");
			out.println("</form><br>");
			out.println("<form action=cart.jsp>");
			out.println("<input type=submit action=index.jsp value='Xem giỏ hàng'>");
			out.println("</form>");
			out.println("</td>");
			out.println("</tr>");
			out.println("<tr><td valign='top' align='left' bgcolor=#C8DBDE colspan=2>Thông tin cấu hình<br><br>"+rst.getString("detail")+"</td></tr>");
		}		
		catch (Exception e) {}
		out.println("</table>");
			
	%>
		
	</TD>
	
	<!---Khai báo khoảng phân cách--->
	<TD bgcolor=white width="2"></TD>
	<TD vAlign=top width="150">
	<%@include file="right.jsp"%>
	</TD>
	</TR>
	
	<!---Khai báo khoảng phân cách--->
	<TR HEIGHT="2">
	<TD colspan=5 bgcolor=white></TD>
	</TR>
	
	<TR HEIGHT="50">
	<TD colspan=5 align=center>
	<%@include file="bottom.jsp"%>
	</TD>
	</TR>
	</TABLE>
</body>

</body>
</html>